/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entities;

import java.io.Serializable;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author corneliugosa
 */
@Entity
@Table(name = "exams")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Exams.findAll", query = "SELECT e FROM Exams e"),
    @NamedQuery(name = "Exams.findByPerson", query = "SELECT e FROM Exams e WHERE e.proffessor = :proffessor"),
    @NamedQuery(name = "Exams.findByClass", query="SELECT e FROM Exams e WHERE e.cls = :cls"),
    @NamedQuery(name = "Exams.findById", query = "SELECT e FROM Exams e WHERE e.id = :id"),
    @NamedQuery(name = "Exams.findPending", query = "SELECT e FROM Exams e WHERE e.status = 0")
})

public class Exams implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id")
    private Integer id;
    @Basic(optional = false)
    @NotNull
    @Lob
    @Size(min = 1, max = 65535)
    @Column(name = "date")
    private String date;
    @Basic(optional = false)
    @NotNull
    @Column(name = "hour")
    private float hour;
    @Basic(optional = false)
    @NotNull
    @Column(name = "status")
    private int status;
    @JoinColumn(name = "id_subject_matter", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private SubjectMatter subjectMatter;
    @JoinColumn(name = "id_proffessor", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Person proffessor;
    @JoinColumn(name = "id_class", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private Class cls;
    @JoinColumn(name = "id_class_reservation", referencedColumnName = "id")
    @ManyToOne(optional = false)
    private ClassroomReservation idClassReservation;

    public Exams() {
    }

    public Exams(Integer id) {
        this.id = id;
    }

    public Exams(Integer id, String date, float hour, int status) {
        this.id = id;
        this.date = date;
        this.hour = hour;
        this.status = status;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getDate() {
        return date;
    }

    public void setDate(String date) {
        this.date = date;
    }

    public float getHour() {
        return hour;
    }

    public void setHour(float hour) {
        this.hour = hour;
    }

    public int getStatus() {
        return status;
    }

    public void setStatus(int status) {
        this.status = status;
    }

    public SubjectMatter getSubjectMatter() {
        return subjectMatter;
    }

    public void setSubjectMatter(SubjectMatter subjectMatter) {
        this.subjectMatter = subjectMatter;
    }

    public Person getProffessor() {
        return proffessor;
    }

    public void setProffessor(Person proffessor) {
        this.proffessor = proffessor;
    }
    
    public Class getCls() {
        return cls;
    }

    public void setCls(Class cls) {
        this.cls = cls;
    }

    public ClassroomReservation getIdClassReservation() {
        return idClassReservation;
    }

    public void setIdClassReservation(ClassroomReservation idClassReservation) {
        this.idClassReservation = idClassReservation;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Exams)) {
            return false;
        }
        Exams other = (Exams) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "entities.Exams[ id=" + id + " ]";
    }
    
}
